<template>
  <keep-alive include="questionList">
    <component
      :is="componentName"
      :classify="classify"
      :question="question"
      @change="changeComponent"
    />
  </keep-alive>
</template>

<script>
import questionList from "./list";
import addQuestion from "./add";
export default {
  components: {
    questionList,
    addQuestion,
  },
  data() {
    return {
      componentName: "questionList",
      classify: null,
      question: null,
    };
  },
  methods: {
    changeComponent({ componentName, classify, question }) {
      this.componentName = componentName;
      this.classify = classify;
      this.question = question;
    },
  },
};
</script>

<style lang="scss" scoped></style>
